// Buffer是nodejs里的一种数据结构
// 1. 创建一个buffer
let a = Buffer.alloc(10,1);
console.log(a);


// 2. 更快速的创建buffer
let b = Buffer.allocUnsafe(10);
b.fill(1);  //填充buffer
console.log(b);

// 3. 手动把数组转成buffer数据
let c = Buffer.from("大家好");
console.log(c);
// 4. 把buffer数据转成字符串
console.log(c.toString());

let d = Buffer.from([0xe5,0xa4,0xa7,0xe5,0xae,0xb6,0xe5,0xa5,0xbd]);
console.log(d);
console.log(d.toString());
